# -*- coding:utf-8 -*-
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import views as auth_views

from .views import *
from django.core.urlresolvers import reverse

urlpatterns = [
    # url(r'^register/$', register, name='register'),
    # url(r'^profile/$', profile, name='profile'),
    # url(r'^profile/change/$', profile_change, name='profile_change'),

    url(r'^register/$', UserRegisterView.as_view(), name='register'),
    url(r'^profile/$', ProfileDetailView.as_view(), name='profile'),
    url(r'^profile/change/$', ProfileUpdateView.as_view(), name='profile_change'),

    url(r'^login/$', login_with_domain, name='login'),
    # url(r'^login/$', auth_views.login, {'template_name': 'registration/login.html'}, name='login'),
    # url(r'^logout/$', 'django.contrib.auth.views.logout',{'template_name':'registration/logged_out.html'},name='logout'),
    url(r'^logout/$', auth_views.logout, {'next_page': '/accounts/login'}, name='logout'),
    url(r'^password_change/$', auth_views.password_change,
        {'template_name': 'registration/password_change_form.html', 'post_change_redirect': "done/"},
        name='password_change'),
    url(r'^password_change/done/$', auth_views.password_change_done,
        {'template_name': 'registration/password_change_done.html'}, name='password_change_done'),

    # 原本不需要指定函数的传递参数，由于不在主app路径下，全部需要重新指派
    url(r'^password_reset/$', auth_views.password_reset, {
        'template_name': 'registration/password_reset_form.html',
        'email_template_name': 'registration/password_reset_email.html',
        'subject_template_name': 'registration/password_reset_subject.txt',
        'post_reset_redirect': 'done/'
    }, name='password_reset'),
    url(r'^password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
    url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', auth_views.password_reset_confirm,
        name='password_reset_confirm'),
    url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
]
